﻿(function () {
    var favoriteColorContext = {};
    favoriteColorContext.Templates = {};
    favoriteColorContext.Templates.Fields = {
        "ColorPickerField": {
            "View": favoriteColorViewTemplate
        }
    };
    SPClientTemplates.TemplateManager.RegisterTemplateOverrides(favoriteColorContext);
})();
function favoriteColorViewTemplate(ctx) {
    var color = ctx.CurrentItem[ctx.CurrentFieldSchema.Name];
    return "<span style='background-color : " + color + "' >&nbsp;&nbsp;&nbsp;&nbsp;</span>&nbsp;";
}